]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Replace 'icon' property in metaInfo with a function
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 28 Feb 2011 19:36:52 +0000 (20:36 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 2 Mar 2011 22:12:35 +0000 (23:12 +0100)
Search results' meta info currently is expected to have an 'icon'
property holding a Clutter.Texture of a fixed icon size. This
property is used to implement the createIcon() function of BaseIcon,
which is used to actually display the result, ignoring the size
parameter due to the fixed icon size.
Given that all available search providers create this property for
the desired icon size using a function with the same signature, it
appears logical to replace the fixed-sized 'icon' property with
such a function, so that the icon size will be defined by the display
actor rather than the search system.

https://bugzilla.gnome.org/show_bug.cgi?id=643632

js/ui/appDisplay.js
js/ui/docDisplay.js
js/ui/placeDisplay.js
js/ui/search.js
js/ui/searchDisplay.js

index 364b637db7064f277b5bd14a1555d19e87854f79..b9f4b1fb4a286c1e7ae5fe027ba34665ea3852db 100644 (file)
@@ -251,7 +251,10 @@ BaseAppSearchProvider.prototype = {
             return null;
         return { 'id': resultId,
                  'name': app.get_name(),
-                 'icon': app.create_icon_texture(Search.RESULT_ICON_SIZE)};
+                 'createIcon': function(size) {
+                                   return app.create_icon_texture(size);
+                               }
+               };
     },
 
     activateResult: function(id, params) {
index 85bbdf978e8de3b92274c9f2d60a034028e05602..26871728a072c04497b9204fffc06fc1e1b7e11b 100644 (file)
@@ -26,7 +26,10 @@ DocSearchProvider.prototype = {
             return null;
         return { 'id': resultId,
                  'name': docInfo.name,
-                 'icon': docInfo.createIcon(Search.RESULT_ICON_SIZE)};
+                 'createIcon': function(size) {
+                                   return docInfo.createIcon(size);
+                               }
+               };
     },
 
     activateResult: function(id, params) {
index a44506e70519b02594e17c854981762577c718e4..450a7ba2b8f87df63a9df989f38ab44ace659897 100644 (file)
@@ -415,7 +415,10 @@ PlaceSearchProvider.prototype = {
             return null;
         return { 'id': resultId,
                  'name': placeInfo.name,
-                 'icon': placeInfo.iconFactory(Search.RESULT_ICON_SIZE) };
+                 'createIcon': function(size) {
+                                   return placeInfo.iconFactory(size);
+                               }
+               };
     },
 
     activateResult: function(id, params) {
index fce5866244840c59af45dd783e35beb7f9c705bf..7e30fc00024a37adf20bba9e3d723bacc77b5d96 100644 (file)
@@ -15,8 +15,6 @@ const Main = imports.ui.main;
 
 const DISABLED_OPEN_SEARCH_PROVIDERS_KEY = 'disabled-open-search-providers';
 
-const RESULT_ICON_SIZE = 48;
-
 // Not currently referenced by the search API, but
 // this enumeration can be useful for provider
 // implementations.
@@ -165,8 +163,9 @@ SearchProvider.prototype = {
      * getResultInfo:
      * @id: Result identifier string
      *
-     * Return an object with 'id', 'name', (both strings) and 'icon' (Clutter.Texture)
-     * properties which describe the given search result.
+     * Return an object with 'id', 'name', (both strings) and 'createIcon'
+     * (function(size) returning a Clutter.Texture) properties which describe
+     * the given search result.
      */
     getResultMeta: function(id) {
         throw new Error('Not implemented');
index 552737ec537e25263ffc4da7baec92397eb3d095..485620c8263bc7cabb767ec9a3d3479d499a47dd 100644 (file)
@@ -36,9 +36,7 @@ SearchResult.prototype = {
                                    reactive: true,
                                    track_hover: true });
             let icon = new IconGrid.BaseIcon(this.metaInfo['name'],
-                                             { createIcon: Lang.bind(this, function(size) {
-                                                 return this.metaInfo['icon'];
-                                             })});
+                                             { createIcon: this.metaInfo['createIcon'] });
             content.set_child(icon.actor);
         }
         this._content = content;